/**
 * Project Name:template-generator
 * File Name   :CodeUtil.java
 * Package Name:org.cn.template.component
 * Date:2015年9月28日下午8:19:59
 * Copyright (c) 2015, http://my.oschina.net/httpssl All Rights Reserved.
 *
*/

package org.cn.template.component;

import java.io.File;

/**
 * ClassName:CodeUtil <br/>
 * Function :TODO ADD FUNCTION. <br/>
 * Reason	:TODO ADD REASON. <br/>
 * Date     :2015年9月28日 下午8:19:59 <br/>
 * @author  :http://my.oschina.net/httpssl
 * @email   :491835898@QQ.COM
 * @since   :JDK 1.7
 * @see 	 
 */
public class CodeUtil
{
	/**
	 * 代码存放目录
	 */
	public static String CODE_DIR = new File("target").getAbsolutePath();

	public static String JDBC_URL = "jdbc:mysql://127.0.0.1:3306/template?characterEncoding=UTF-8";
	public static String JDBC_DRIVERCLASSNAME = "com.mysql.jdbc.Driver";
	public static String JDBC_USERNAME = "root";
	public static String JDBC_PASSWORD = "123456";

	public static void main(String[] args) throws Exception {
		

		// 以下参数的名称各位都小写
		String [] tabs = new String[]{"tab_category"};
		String [] decs = new String[]{"系统分类"};
		String appBaseNamespace = "com.template.app";
		// 作者
		String author = "马云";
		for(int i=0;i<tabs.length;i++)
		{
			// 表名
			String tableName = tabs[i];
			// 描述
			String desc = decs[i];
			// model所在的包名
			String modelNameSpace = appBaseNamespace + ".model";
			// service接口所在的包名
			String serviceNameSpace = appBaseNamespace+".service";
			// service实现类所在的包名
			String serviceImplNameSpace = appBaseNamespace + ".service.impl";
			// dao接口所在的包名
			String daoNameSpace = appBaseNamespace + ".repository";
			String controllerNameSpace = appBaseNamespace+ '.'+"control";
			CodeMapModel codeMapModel = new CodeMapModel(tableName,controllerNameSpace, modelNameSpace,
					serviceNameSpace, serviceImplNameSpace, daoNameSpace, null,desc,appBaseNamespace);
			codeMapModel.setAuthor(author);
			GenerateCode.createAll(codeMapModel);
			GenerateCode.propertyMap.clear();
		}
		
		System.out.println("生成完毕!");
	}
	
}
